<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head lang="zh-cn">
<meta charset="UTF-8" />
<meta name="viewport"
	content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-touch-fullscreen" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=no" />
<meta name="description" content="厚和尚品" />
<meta name="keywords" content="厚和尚品" />
<title>会员登录</title>
<link rel="apple-touch-icon-precomposed" href="" />
<link rel="apple-touch-startup-image" href="" />
<link rel="stylesheet" href="mall/css/css.css"
	th:href="@{/mall/css/css.css}" />
<link rel="stylesheet" href="mall/lib/layer/layer_mobile/need/layer.css"
	th:href="@{/mall/lib/layer/layer_mobile/need/layer.css}" />
<script type="text/javascript" src="mall/lib/zpeto/zepto-1.2.0.min.js"
	th:src="@{/mall/lib/zpeto/zepto-1.2.0.min.js}"></script>
<script type="text/javascript"
	src="mall/lib/layer/layer_mobile/layer.js"
	th:src="@{/mall/lib/layer/layer_mobile/layer.js}"></script>
<script type="text/javascript" src="mall/lib/swiper/swiper.jquery.min.js" th:src="@{/mall/lib/swiper/swiper.jquery.min.js}"></script>
    <script type="text/javascript" src="mall/js/comm.js" th:src="@{/mall/js/comm.js}"></script>

</head>
<body>
	<div class="form">
		<div class="form-form">
			<div class="form-item mui-flex">
				<div class="cell fixed img">
					<img th:src="@{/mall/img/ico-people-red.png}" alt="" />
				</div>
				<div class="cell">
					<input type="text" class="ipt" id="user_name" placeholder="会员号" />
				</div>
			</div>
			<div class="form-item mui-flex">
				<div class="cell fixed img">
					<img th:src="@{/mall/img/ico-lock-red.png}" alt="" />
				</div>
				<div class="cell">
					<input type="password" id="pwd" class="ipt" placeholder="密码" />
				</div>
			</div>
		</div>
		<div class="ft-btn-wrap">
			<div class="btn btn-red" ontouchend="login();" id="login_btn">立即登录</div>
		</div>
	</div>
	<script>
	function login(){
		var user_name = $('#user_name').val();
		var pwd = $('#pwd').val();
		if ($.trim(user_name) == '') {
			layer.open({
				content : '请输入用户名！',
				skin : 'msg',
				time : 2
			//2秒后自动关闭
			});
			return;
		} else if (pwd == '') {
			layer.open({
				content : '请输入密码！',
				skin : 'msg',
				time : 2
			//2秒后自动关闭
			});
			return;
		} else {
			$.ajax({
				type:'post',
				url:'/member/login',
				dataType:'json',
				data:{'memberId':user_name,'password':pwd},
			    success:function(data){
			    	if(data.result == 'success'){
			    		location.href='/member/main';
			    		layer.open({
							content : '登录成功！',
							skin : 'msg',
							time : 2
						//2秒后自动关闭
						});
			    	}else{
			    		layer.open({
							content : '用户名或密码错误！',
							skin : 'msg',
							time : 2
						//2秒后自动关闭
						});
			    	}
			    },
			    error:function(){
			    	layer.open({
						content : '登录异常！',
						skin : 'msg',
						time : 2
					//2秒后自动关闭
					});
			    }
			});
			
		}
	}
	</script>
</body>
</html>